package com.xutils;

import com.xutils.netty.http.HttpClient;
import com.xutils.netty.push.PushCallBack;
import com.xutils.netty.push.PushMsgLongClient;

/**
 * Created by ktian on 2014/9/22.
 */
public class NettyUtils {

    private static NettyUtils instance;

    private NettyUtils() {}

    public static NettyUtils getInstance() {
        if( instance == null ) {
            instance = new NettyUtils();
        }
        return instance;
    }

    /////////////////////////////////////////推送/////////////////////////////////////////////////////////
    private PushMsgLongClient mPushMsgLongClient;
    /**
     * 打开推送长连接
     * @param ip
     * @param port
     */
    public void startPushService(String ip, int port, PushCallBack listener) throws Exception{
        mPushMsgLongClient = new PushMsgLongClient();
        mPushMsgLongClient.run(ip, port, listener);
    }

    /**
     * 关闭推送长连接
     */
    public void stopPushService() {
        mPushMsgLongClient.stop();
    }

}
